<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<title>单点业务系统管理</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/skins/home.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/ymPrompt/skin/qq/ymPrompt.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/validForm/css/style.css" />
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.6.4.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.form.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/ymPrompt/ymPrompt.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/validForm/validForm-5.3.2.min.js"></script>
	</head>
	<body>
		<form id="addForm" action="" method="post">
			<!-- portal begin -->
			<div class="g-btns margin-b-10 align-r">
				<span class="g-big-btn" onClick="javascript:$('#addForm').submit();">
					<a class="g-big-btn-inner">
						<b>保存</b> <b class="g-big-btn-rc g-big-btn-rc-1"></b> <b
						class="g-big-btn-rc g-big-btn-rc-2"></b> </a> </span>
				<span class="g-big-btn" onClick="closewindow();"> <a
					class="g-big-btn-inner"> <b>关闭</b>
						<b class="g-big-btn-rc g-big-btn-rc-1"></b> <b
						class="g-big-btn-rc g-big-btn-rc-2"></b> </a> </span>
			</div>
			<div class="pt-pt pt-chg-Gray">
				<div class="pt-pt-tit">
					<table class="p-p-t-ent">
						<tr>
							<td class="p-p-t-ent-l">
								<i>&nbsp;</i>
							</td>
							<td class="p-p-t-ent-c">
								<div class="p-p-t-13-d">
									<span class="p-p-t-t">修改业务系统信息</span>
								</div>
							</td>
							<td class="p-p-t-ent-r">
								<i>&nbsp;</i>
							</td>
						</tr>
					</table>
				</div>
				<div class="pt-pt-cont">
					<table class="addDataList" cellpadding="0" cellspacing="0" style="width: 100%; border: 0px;">
						<tbody>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td style="width: 160px;">
									系统简称
								</td>
								<td>
									<input name="shortName" class="fm_input" type="text" value="${system.shortName}"
										id="shortName" datatype="s" nullmsg="请输入系统简称!"/>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									系统编码
								</td>
								<td>
									<input name="code" class="fm_input" type="text" id="code" value="${system.code}"
										datatype="dx" nullmsg="请输入系统编码!"
										errormsg="系统编码由大写字母组成,长度为2-10位!" 
										ajaxurl="${pageContext.request.contextPath}/ssoSystem/ssoSystemMgr!check?beId=${system.id}"/>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									系统全称
								</td>
								<td>
									<input name="fullName" class="fm_input" type="text" value="${system.fullName}"
										id="fullName" datatype="s" nullmsg="请输入系统全称!"/>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									是否公共业务系统
								</td>
								<td>
									<select name="isPublic" id="isPublic" class="fm_select">
										<s:if test='#request.system.isPublic == "N"'>
											<option value="N" selected="selected">
												N
											</option>
											<option value="Y">
												Y
											</option>
										</s:if>
										<s:else>
											<option value="N">
												N
											</option>
											<option value="Y" selected="selected">
												Y
											</option>
										</s:else>
									</select>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									登录URL
								</td>
								<td>
									<input name="loginUrl" class="fm_input" type="text" style="width: 400px;"
										id="loginUrl" datatype="*" nullmsg="请输入系统登录地址!" value="${system.loginUrl}" />
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									是否显示
								</td>
								<td>
									<select name="isShow" id="isShow" class="fm_select">
										<s:if test='#request.system.isShow == "Y"'>
											<option value="Y" selected="selected">
												Y
											</option>
											<option value="N">
												N
											</option>
										</s:if>
										<s:else>
											<option value="Y">
												Y
											</option>
											<option value="N" selected="selected">
												N
											</option>
										</s:else>
									</select>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									是否启用常用业务
								</td>
								<td>
									<select name="cbWsEnable" id="cbWsEnable" class="fm_select" onchange="changeCBShow()">
										<s:if test='#request.system.cbWsEnable == "Y"'>
											<option value="Y" selected="selected">
												Y
											</option>
											<option value="N">
												N
											</option>
										</s:if>
										<s:else>
											<option value="Y">
												Y
											</option>
											<option value="N" selected="selected">
												N
											</option>
										</s:else>
									</select>
								</td>
							</tr> 
							<tr id="cbpw" style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									常用业务webservice地址
								</td>
								<td>
									<input name="cbWsUrl" class="fm_input" type="text" id="cbWsUrl" 
										style="width: 400px;" datatype="*" ignore="ignore" value="${system.cbWsUrl}" />
								</td>
							</tr> 
							<tr id="cbpw" style="font-family: \5b8b\4f53; font-size: 12px;">
								<td style="width: 160px;">
									常用业务webservice命名空间
								</td>
								<td>
									<input name="cbWsNameSpace" class="fm_input" type="text" value="${system.cbWsNameSpace}"
										style="width: 400px;" id="cbWsNameSpace" datatype="*" ignore="ignore" />
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									待办webservice地址
								</td>
								<td>
									<input name="zdWsUrl" class="fm_input" type="text"  value="${system.zdWsUrl}"
										style="width: 400px;" datatype="*" ignore="ignore" />
								</td>
							</tr> 
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td style="width: 160px;">
									待办webservice命名空间
								</td>
								<td>
									<input name="zdWsNameSpace" class="fm_input" type="text" value="${system.zdWsNameSpace}"
										style="width: 400px;" datatype="*" ignore="ignore" />
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									系统图标
								</td>
								<td>
									<s:iterator id="imgs" value="#request.imglist" status="stut">
										<div style="width:30px;float:left;padding:0 10px;">
											<img src="${pageContext.request.contextPath}/img/icons/<s:property />"/>
											<p style="float:left;text-align:center;width:30px;">
												<input <s:if test="#request.system.imageName == #imgs">checked</s:if> 
													name="imageName" type="radio" value="<s:property />" id="imageName" />
											</p>
										</div>
									</s:iterator>
								</td>
							</tr>
							<tr style="font-family: \5b8b\4f53; font-size: 12px;">
								<td>
									概要
								</td>
								<td>
									<textarea name="summary" class="fm_textarea" id="summary"
										style="width: 400px;" datatype="*" ignore="ignore">${system.summary}</textarea>
								</td>
							</tr>
							
						</tbody>
					</table>
				</div>
			<div class="pt-pt-bt-corner">
				<b class="pt-pt-bt-cor-l">&nbsp;</b>
				<b class="pt-pt-bt-cor-r">&nbsp;</b>
			</div>
			</div>
			<!-- portal end -->
		</form>
	</body>
	<script type="text/javascript">
		$(document).ready(
			function() {
	            var options = {
	            	url: "${pageContext.request.contextPath}/ssoSystem/ssoSystemMgr!update?userId=${userId}&id=${system.id}",
	            	type: "POST",
	            	dataType: "json",
	            	success: function(data) {
						changeSelectDisplay('none');
	            		if (data.status == 'y') {
							ymPrompt.succeedInfo({message: data.info, maskAlpha: 0, handler: function handl(){
								changeSelectDisplay('');
								if (window.opener) {
									window.opener.location.href = window.opener.location.href;
								}
								window.close();
							}});
						} else {
							ymPrompt.errorInfo({message: data.info, maskAlpha: 0, handler: function showSelect() {
								changeSelectDisplay('');
							}});
						}
	            	}
	            };
	            $("#addForm").ajaxForm(options);
	            changeCBShow();
	        }
        );
		
		$("#addForm").Validform({
			tiptype: 4,
			datatype: {
				"dx": /^[A-Z]{2,10}$/,
				"zs": /^([0-9]|([1-9][0-9]{1,2}))$/,
				"img": /^.*\.jpg|.*\.jpeg|.*\.png|.*\.bmp|.*\.gif$/i
			}
		});
		
		function closewindow(){
			if (window.parent) {
				window.close();
			}
		}
		
		//是否有常用业务，如果有则展现webservice地址与命名空间的填写框，否则就不展现
		function changeCBShow() {
			var p1 = $('#cbWsEnable').val();
			var trs = $('tr[id="cbpw"]');
			var length = trs.length;
		   	if (p1 == 'Y') {
				for (var i = 0; i < length; i ++) {
					trs[i].style.display = '';
					$('#cbWsUrl').removeAttr('disabled');
					$('#cbWsNameSpace').removeAttr('disabled');
				}
			} else if (p1 == 'N') {
				for (var i = 0; i < length; i ++) {
					trs[i].style.display = 'none';
					$('#cbWsUrl').attr('disabled', 'disabled');
					$('#cbWsNameSpace').attr('disabled', 'disabled');
				}
			}
		}
	    
	    function changeSelectDisplay(display) {
	    	var selectObjs = $('select');
	    	for (var i = 0; i < selectObjs.length; i ++) {
	    		selectObjs[i].style.display = display;
	    	}
	    }
		
		function stop(){
			return false;
		}
		document.oncontextmenu = stop;
	</script>
</html>
